﻿@using System.Collections
@model MvcApplication2.Models.Exercise
@{
}
<h2>
    @ViewBag.Title</h2>
<script src="@Url.Content("~/Scripts/jquery.validate.min.js")"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")"></script>
<form method="post" class="well form-horizontal">
@Html.ValidationSummary(true)
<fieldset>
    <legend>Legend text</legend>
    @Html.HiddenFor(m => m.ExerciseId)
    @Html.HiddenFor(m => m.OwnerId)
    @Html.HiddenFor(m => m.Status)
    <div class="control-group">
        @Html.LabelFor(model => model.Title, new { @class = "control-label" })
        <div class="controls">
            @Html.EditorFor(model => model.Title, new { @class = "input-xlarge" })
            @Html.ValidationMessageFor(model => model.Title, null, null)
            <p class="help-block">
                Titolo esercizio</p>
        </div>
    </div>
    <div class="control-group">
        @Html.LabelFor(model => model.Instruction, new { @class = "control-label" })
        <div class="controls">
            @Html.TextAreaFor(model => model.Instruction, new { @class = "input-xlarge" })
            @Html.ValidationMessageFor(model => model.Instruction, null, null)
            <p class="help-block">
                (opz) Scrivere le istruzioni per tester</p>
        </div>
    </div>
    <div class="control-group">
        @Html.LabelFor(model => model.Device, new { @class = "control-label" })
        <div class="controls">
            @Html.DropDownListFor(model => model.DeviceId, new SelectList((IEnumerable)ViewBag.Devices,
            "DeviceId", "Description"), new { @class = "input-xlarge" })
            @Html.ValidationMessageFor(model => model.Device, null, null)
            <p class="help-block">
                Scegliere il dispositivo sul quale gira applicazione</p>
        </div>
    </div>
    <div class="form-actions">
        @if (Model == null || Model.Status != "published")
        {
            <button class="btn btn-success" type="submit" name="publish">
                <i class="icon-ok icon-white"></i>Publish</button>        
        }
        <button class="btn btn-primary" name="save">
            Save Changes</button>
        <button class="btn">
            Cancel</button>
    </div>
</fieldset>
</form>
<div>
    @Html.ActionLink("Back to List", "Exercises","Developer", null, new { @class = "btn btn-inverse" })
</div>
